package com.aerfafish.spider.neo4j.repository;

import com.aerfafish.spider.neo4j.dao.FundEstablishDate;
import org.springframework.data.neo4j.annotation.Query;
import org.springframework.data.neo4j.repository.Neo4jRepository;
import org.springframework.data.repository.query.Param;
import org.springframework.stereotype.Service;

@Service
public interface FundEstablishDateRepository extends Neo4jRepository<FundEstablishDate, Long> {

    @Query("merge (fund:Fund{code: $fundCode}) " +
            "merge (date:Date{date: $date}) " +
            "merge p = (fund) - [r:FUND_ESTABLISH_DATE] -> (date)")
    void save(@Param("fundCode") String fundCode, @Param("date") String date);

}
